/*
 * @Description: 
 * @Author: Jimmy
 * @Date: 2023-07-24 21:45:02
 * @LastEditTime: 2023-07-24 23:05:47
 * @LastEditors:  
 */
import { createClient } from "redis";

/**
 * The above code connects to localhost on port 6379. To connect to a different host or port, 
 * use a connection string in the format 
 * redis[s]://[[username][:password]@][host][:port][/db-number]:
    createClient({
    url: 'redis://alice:foobared@awesome.redis.server:6380'
    });
 */
const client = createClient({ socket : { host:'127.0.0.1', port:6379 } });
client.connect();
//监听报错
client.on('error',(error)=>{
    console.error('Redis 连接错误 ',error)
});

export default client
